<include file="public@header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('Cate/rockIndex')}">{:lang('CATE_TITLE')}</a></li>
			<li><a href="{:url('Cate/addRockCate')}">{:lang('ADD_CATE')}</a></li>
		</ul>
		<form action="{:url('Cate/listorders')}" method="post">
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th>{:lang('CATE_NAME')}</th>
						<th>{:lang('CREAT_TIME')}</th>
						<th>{:lang('SORT_ORDER')}</th>
						<th>{:lang('IF_SHOW')}</th>
						<th>{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
                	<php>$status = array('0' => L('IS_SHOW'), '1' => L('IS_HIDEN'));</php>
					<foreach name="results" item="cate">
					<tr>
						<td>{$cate.cate_name}</td>
						<td><php>echo date('Y-m-d H:i:s', $cate['add_time'])</php></td>
						<td>{$cate.sort_order}</td>
						<td>
							<if condition="$cate['if_show'] eq 1">
								<font color="red">√</font>
							<else /> 
								<font color="red">╳</font>
							</if>
						</td>
						<td>
                            <a href="{:url('Cate/editGoodsCate',array('id'=>$cate['id'],'mark'=>$cate['mark']))}">{:lang('EDIT')}</a>
                            |
                            <a href="{:url('Cate/delete',array('id'=>$cate['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
                            |
                            <a class="js-ajax-delete" data-msg="确定更改为 <b>{$status[$cate['if_show']]}</b> 状态吗？" 
                            	href="{:url('Cate/toggle',array('id'=>$cate['id'],'show'=>$cate['if_show']))}">{:lang('TOGGLE')}</a>
                            |
                            <a href="{:url('Cate/add',array('id'=>$cate['id'],'mark'=>$cate['mark']))}">{:lang('ADD_CHILD')}</a>
						</td>
					</tr>
                    <foreach name="cate['sub']" item="vo">
                    	<tr>
                            <td>&nbsp;&nbsp;&nbsp;<if condition="count($cate['sub']) eq ($key+1)">└─<else />├─</if>&nbsp;{$vo.cate_name}</td>
                            <td><php>echo date('Y-m-d H:i:s', $vo['add_time'])</php></td>
                            <td>{$vo.sort_order}</td>
                            <td>
                                <if condition="$vo['if_show'] eq 1">
                                    <font color="red">√</font>
                                <else /> 
                                    <font color="red">╳</font>
                                </if>
                            </td>
                            <td>
                                <a href="{:url('Cate/editGoodsCate',array('id'=>$vo['id'],'mark'=>$vo['mark']))}">{:lang('EDIT')}</a>
                                |
                                <a href="{:url('Cate/delete',array('id'=>$vo['id'],))}" class="js-ajax-delete">{:lang('DELETE')}</a>
                                |
                                <a class="js-ajax-delete" data-msg="确定更改为 <b>{$status[$vo['if_show']]}</b> 状态吗？" 
                                    href="{:url('Cate/toggle',array('id'=>$vo['id'],'show'=>$vo['if_show']))}">{:lang('TOGGLE')}</a>
                            </td>
                        </tr>
                    </foreach>
					</foreach>
				</tbody>
			</table>
		</form>
	</div>
	<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
    	<script>
		$(function() {
			$("#cate_select").change(function() {
				$("#mainform").submit();
			});

		});
	</script>
</body>
</html>